function config=initialize_config(data,input,config_id)

    %%%%%%%%%%%%%%%%
    % UNCONSTRAINED B-SPLINE QUANTILE, CONSTRAINED B-SPLINE QUANTILE, UNCONSTRAINED B-SPLINE MEAN, CONSTRAINED B-SPLINE MEAN
    %%%%%%%%%%%%%%%%

if config_id==1 || config_id==2 || config_id==3 || config_id==4;

        %%%%%%%%%%%%%%%%
        % LOAD IN
        %%%%%%%%%%%%%%%%
    
    n1=input.n1; 
    k1=input.k1; 
    n2=input.n2;
    k2=input.k2;
    reps=input.reps;
    CI=input.CI;
    
    p=data.p;
    y=data.y;
    share=data.share;
    Z=data.Z;
    N=data.N;
    
    p_interest=data.p_interest;
    y_interest=data.y_interest;
    p_interest_univ=data.p_interest_univ;
    y_interest_univ=data.y_interest_univ;

    p_grid_constraint=data.p_grid_constraint;
    y_grid_constraint=data.y_grid_constraint;
    
    log_y_mu=data.log_y_mu;
    log_y_sd=data.log_y_sd;
    
    tau=input.tau;
    
        %%%%%%%%%%%%%%%%
        % CONFIGURE
        %%%%%%%%%%%%%%%%
        
    factor_extend=0.2;
        
    xi1=construct_xi_ext(p,n1,k1,factor_extend);
    xi2=construct_xi_ext_normal(y,n2,k2,factor_extend,log_y_mu,log_y_sd);
    
    [S, S_deriv1, S_deriv2]            =construct_splines_twodim  (p, y, xi1,      xi2, n1,      n2, k1,      k2,-k1,     -k2,n1-1,     n2-1,0);
    [S_interest, S_deriv1_interest, S_deriv2_interest]            =construct_splines_twodim(p_interest, y_interest, xi1, xi2, n1,n2, k1,k2,-k1,-k2,n1-1,n2-1,0);
    
        %%%%%%%%%%%%%%% 
        % OUTPUT        
        %%%%%%%%%%%%%%%
    
    config.p=p;
    config.y=y;    
    config.share=share;
    config.Z=Z;
    config.N=N;
    config.S=S;
    config.S_deriv1=S_deriv1;
    config.S_deriv2=S_deriv2;
    config.S_interest=S_interest;
    config.S_deriv1_interest=S_deriv1_interest;
    config.S_deriv2_interest=S_deriv2_interest;
    config.xi1=xi1;
    config.xi2=xi2;
    
    config.p_interest=p_interest;
    config.y_interest=y_interest;
    config.p_interest_univ=p_interest_univ;
    config.y_interest_univ=y_interest_univ;
    config.p_grid_constraint=p_grid_constraint;
    config.y_grid_constraint=y_grid_constraint;
    
    config.log_y_mu=log_y_mu;
    config.log_y_sd=log_y_sd;
       
    config.tau=tau;
    config.reps=reps;
    config.CI=CI;

end

    %%%%%%%%%%%%%%%%%%%%%%%%%%
	% LINEAR QUANTILE REGRESSION
	%%%%%%%%%%%%%%%%%%%%%%%%%%

if config_id==5;

        %%%%%%%%%%%%%%% 
        % INPUT
        %%%%%%%%%%%%%%%

    reps=input.reps;
    CI=input.CI;
    tau=input.tau;

    p=data.p;
    y=data.y;
    share=data.share;
	Z=data.Z;
    N=data.N;

    log_y_mu=data.log_y_mu;
    log_y_sd=data.log_y_sd;

    p_interest=data.p_interest;
    y_interest=data.y_interest;
    p_interest_univ=data.p_interest_univ;
    y_interest_univ=data.y_interest_univ;

    p_grid_constraint=data.p_grid_constraint;
    y_grid_constraint=data.y_grid_constraint;

        %%%%%%%%%%%%%%%%
        % CONFIGURE
        %%%%%%%%%%%%%%%%

    S=[ones(N,1) p y];
    S_interest=[ones(size(p_interest,1),1) p_interest y_interest];
    S_deriv1_interest=[zeros(size(p_interest,1),1) ones(size(p_interest,1),1) zeros(size(p_interest,1),1)];
    S_deriv2_interest=[zeros(size(p_interest,1),1) zeros(size(p_interest,1),1) ones(size(p_interest,1),1)];
    
        %%%%%%%%%%%%%%% 
        % OUTPUT        
        %%%%%%%%%%%%%%%

    config.S=S;
    config.S_interest=S_interest;
    config.S_deriv1_interest=S_deriv1_interest;
    config.S_deriv2_interest=S_deriv2_interest;
    config.p_interest=p_interest;
    config.y_interest=y_interest;
    config.p_interest_univ=p_interest_univ;
    config.y_interest_univ=y_interest_univ;
    config.p_grid_constraint=p_grid_constraint;
    config.y_grid_constraint=y_grid_constraint;

    config.log_y_mu=log_y_mu;
    config.log_y_sd=log_y_sd;

    config.p=p;
    config.y=y;    
    config.share=share;
	config.Z=Z;
    config.N=N;

    config.tau=tau;
    config.reps=reps;
    config.CI=CI;
        
end;



    %
